/****************************************************************************
**                                                                         **
**                      PSSDK HNAdapterConfig module                       **
**            Copyright (c) 1997 - 2006 microOLAP Technologies LTD,        **
**                       Khalturin A.P., Naumov D.A.                       **
**                               Header File                               **
**                                                                         **
****************************************************************************/

//---------------------------------------------------------------------------
#ifndef __HN_PSSDK_ADAPTERCONFIG_H__
#define __HN_PSSDK_ADAPTERCONFIG_H__ 
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
// Class CHNAdapterConfig
//---------------------------------------------------------------------------
class CHNAdapterConfig
{
private:
    HANDLE hCfg;

public:
    //###########################################################################
    //    Create & Destroy
    //###########################################################################

    //---------------------------------------------------------------------------
    // Contructor
    CHNAdapterConfig() { hCfg = NULL; }

    //---------------------------------------------------------------------------
    // Destructor
    ~CHNAdapterConfig() {}

public:
    //###########################################################################
    //    Additionals methods
    //###########################################################################
    BOOL     IsValid() { return (BOOL)(hCfg != NULL); }
    HANDLE   Set_Handle(HANDLE h_Cfg) { return hCfg = h_Cfg; }
    HANDLE   Get_Handle() { return hCfg; }
    operator HANDLE() { return hCfg; }
    HANDLE   operator =(HANDLE h_Cfg) { return hCfg = h_Cfg; }


public:
    //###########################################################################
    //    Methods of redirect
    //###########################################################################

    //---------------------------------------------------------------------------
    // AdpCfgGetAdapterName - Returns the network adapter system name.
    LPCSTR Get_AdapterName() 
    { return AdpCfgGetAdapterName(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetAccessibleState - Returns the network adapter accessibility status.
    BOOL Get_AccessibleState() 
    { return AdpCfgGetAccessibleState(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetAdapterDescription - Returns the network adapter description.
    LPCSTR Get_AdapterDescription() 
    { return AdpCfgGetAdapterDescription(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetAdapterType - Returns the network adapter type.
    DWORD Get_AdapterType() 
    { return AdpCfgGetAdapterType(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetMaxPacketSize - Returns the network adapter packet maximum size.
    DWORD Get_MaxPacketSize() 
    { return AdpCfgGetMaxPacketSize(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetMACAddrSize - Returns the MAC address size.
    DWORD Get_MACAddrSize() 
    { return AdpCfgGetMACAddrSize(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetMACAddress - Returns the MAC address of the network adapter.
    DWORD Get_MACAddress(LPVOID pMacAddress, DWORD BufferSize) 
    { return AdpCfgGetMACAddress(hCfg,pMacAddress,BufferSize); }

    //---------------------------------------------------------------------------
    // AdpCfgGetMACHeaderSize - Returns the MAC header size.
    DWORD Get_MACHeaderSize() 
    { return AdpCfgGetMACHeaderSize(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetZeroBroadcastState - Returns the status of IP zero broadcast usage.
    BOOL Get_ZeroBroadcastState() 
    { return AdpCfgGetZeroBroadcastState(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetDhcpState - Returns the status of the DHCP using.
    BOOL Get_DhcpState() 
    { return AdpCfgGetDhcpState(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIpCount - Returns the number of IP addresses, assigned to the network adapter card.
    DWORD Get_IpCount() 
    { return AdpCfgGetIpCount(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIp - Returns one of the IP addresses, assigned to the network adapter.
    LPCSTR Get_Ip(int Index) 
    { return AdpCfgGetIp(hCfg,Index); }

    //---------------------------------------------------------------------------
    // AdpCfgGetSubnetMask - Returns the subnet mask that matches to the corresponding IP address index.
    LPCSTR Get_SubnetMask(int Index) 
    { return AdpCfgGetSubnetMask(hCfg,Index); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIpDhcpCount - Returns the number of the IP addresses of DHCP servers set on the system.
    DWORD Get_IpDhcpCount() 
    { return AdpCfgGetIpDhcpCount(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIpDhcp - Returns one of the IP addresses of DHCP servers set on the system.
    LPCSTR Get_IpDhcp(int Index) 
    { return AdpCfgGetIpDhcp(hCfg,Index); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIpGatewayCount - Returns the number of the gateways IP addresses.
    DWORD Get_IpGatewayCount() 
    { return AdpCfgGetIpGatewayCount(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIpGateway - Returns one of the IP addresses of the gateways set on the system.
    LPCSTR Get_IpGateway(int Index) 
    { return AdpCfgGetIpGateway(hCfg,Index); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIpDnsCount - Returns the number of the IP addresses of DNS servers set on the system.
    DWORD Get_IpDnsCount() 
    { return AdpCfgGetIpDnsCount(hCfg); }

    //---------------------------------------------------------------------------
    // AdpCfgGetIpDns - Returns one of the IP addresses of the DNS servers set on the system.
    LPCSTR Get_IpDns(int Index) 
    { return AdpCfgGetIpDns(hCfg,Index); }

    //---------------------------------------------------------------------------
    // AdpCfgUpdate - Updates the network adapter configuration.
    DWORD Update(DWORD ChangeType) 
    { return AdpCfgUpdate(hCfg,ChangeType); }     
};

//---------------------------------------------------------------------------
#endif // __HN_PSSDK_ADAPTERCONFIG_H__
//---------------------------------------------------------------------------
